package se.janlindblom.ordning.typ.samling;

/**
 * $Id: Aktiviteter.java 50 2009-12-04 14:19:41Z lindblom.jan $
 * 
 * Copyright (c) 2009, Jan Lindblom
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * * Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * 
 * * Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * 
 * * Neither the name of the project nor the names of its contributors may be
 *   used to endorse or promote products derived from this software without
 *   specific prior written permission.
 *   
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * 
 */

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;

import se.janlindblom.ordning.typ.Uppgift;
import se.janlindblom.ordning.typ.Kategori;

/**
 * Aktiviteter - a collection of {@link Uppgift} activities with a given {@link Kategori} category.
 * 
 * @author Jan Lindblom (lindblom.jan@gmail.com)
 * @version $Rev: 50 $
 *
 */
public class Aktiviteter implements List<Uppgift> {
	private Vector<Uppgift> activities;
	private Kategori category;
	
	/**
	 * Creates a new Aktiviteter collection with a new {@link Kategori} category.
	 */
	public Aktiviteter() {
		activities = new Vector<Uppgift>();
		category = new Kategori();
	}
	
	/**
	 * Creates a new Aktiviteter collection with a given {@link Kategori} category.
	 * 
	 * @param category the Kategori category to set
	 */
	public Aktiviteter(Kategori category) {
		this();
		this.setCategory(category);
	}
	
	/**
	 * @param activity
	 * @return
	 */
	@Override
	public boolean add(Uppgift activity) {
		return activities.add(activity);
	}

	/**
	 * Returns the {@link Uppgift} object at the given index in this Aktiviteter collection.
	 * 
	 * @param arg0 index of the {@link Uppgift} to get
	 * @return the {@link Uppgift} at the given index
	 */
	@Override
	public Uppgift get(int arg0) {
		return activities.get(arg0);
	}

	/**
	 * Returns the size of this Aktiviteter collection.
	 * 
	 * @return the size of this Aktiviteter collection
	 */
	@Override
	public int size() {
		return activities.size();
	}

	/**
	 * @return the {@link Kategori} category of this Aktiviteter collection
	 */
	public Kategori getCategory() {
		return category;
	}

	/**
	 * @param category the {@link Kategori} category to set
	 */
	public void setCategory(Kategori category) {
		this.category = category;
	}

	@Override
	public boolean addAll(Collection<? extends Uppgift> c) {
		return activities.addAll(c);
	}

	@Override
	public boolean addAll(int index, Collection<? extends Uppgift> c) {
		return activities.addAll(index, c);
	}

	@Override
	public void clear() {
		activities.clear();
	}

	@Override
	public boolean contains(Object o) {
		return activities.contains(o);
	}

	@Override
	public boolean containsAll(Collection<?> c) {
		return activities.containsAll(c);
	}

	@Override
	public int indexOf(Object o) {
		return activities.indexOf(o);
	}

	@Override
	public boolean isEmpty() {
		return activities.isEmpty();
	}

	@Override
	public Iterator<Uppgift> iterator() {
		return activities.iterator();
	}

	@Override
	public int lastIndexOf(Object o) {
		return activities.lastIndexOf(o);
	}

	@Override
	public ListIterator<Uppgift> listIterator() {
		return activities.listIterator();
	}

	@Override
	public ListIterator<Uppgift> listIterator(int index) {
		return activities.listIterator(index);
	}

	@Override
	public boolean remove(Object o) {
		return activities.remove(o);
	}

	@Override
	public Uppgift remove(int index) {
		return activities.remove(index);
	}

	@Override
	public boolean removeAll(Collection<?> c) {
		return activities.removeAll(c);
	}

	@Override
	public boolean retainAll(Collection<?> c) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Uppgift set(int index, Uppgift element) {
		return activities.set(index, element);
	}

	@Override
	public List<Uppgift> subList(int fromIndex, int toIndex) {
		return activities.subList(fromIndex, toIndex);
	}

	@Override
	public Object[] toArray() {
		return activities.toArray();
	}

	@Override
	public <T> T[] toArray(T[] a) {
		return activities.toArray(a);
	}

	@Override
	public void add(int index, Uppgift element) {
		activities.add(index, element);
	}
}
